最近开始学习 openresty 相关的东西,了解了基本的 lua 语法自然需要安装 openresty 了。
过程中遇到不少问题,记录下来。
Mac 的系统版本是 EI Capitan 10.11.6,openresty 版本是1.9.15.1。
编译需要的相关依赖
openssl: 1.0.2h_1,如果没有安装,需要先
brew install openssl
pcre: 8.37,同上需要安装
执行命令1
./configure --prefix=/opt/openresty \
--with-cc-opt="-I/usr/local/Cellar/pcre/8.37/include/" \
--with-luajit --without-http_redis2_module --with-ld-opt="-L/usr/local/lib" \
--with-openssl=/Users/xiongjie/Downloads/openssl-1.0.2h --with-pcre
编译完成之后make,make install.
问题主要是出在编译 Nginx 的时候,如果make出现错误1
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [objs/nginx] Error 1
make: *** [build] Error 2
注意configure命令,–with-pcre 后面不需要参数,官方文档
–with-pcre=*path
sets the path to the sources of the PCRE library. The library distribution (version 4.4 — 8.21)
needs to be downloaded from the PCRE site and extracted. The rest is done by NGINX’s ./configure and make.
The library is required for regular expressions support in the location directive and for
the ngx_http_rewrite_module. See notes below for using system PCRE on FreeBSD systems.
可能是版本问题导致,我安装的版本比官方文档建议的高,编译的时候设置路径就编译的文件就不能正常安装。